<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<title>授权一览</title>
<head th:replace="common/incHead :: incHead"></head>
<body class="gray-bg">
<div class="ok-body">
    <form class="layui-form layui-form-pane" lay-filter="pagerForm" id="pagerForm" action="/sys/auth" method="get">
        <input type="hidden" id="pageNum" name="pageNum" value="1"/>
        <input type="hidden" id="numPerPage" name="numPerPage" th:value="${page.numPerPage}"/>
        <input type="hidden" id="orderField" name="orderField" th:value="${orderField}"/>
        <input type="hidden" id="orderDirection" name="orderDirection" th:value="${orderDirection}"/>
        <div class="layui-row pa-condition">
            <div class="layui-row">
                <div class="layui-inline layui-col-md3 p-r-xxs">
                    <label class="layui-form-label" th:text="授权ID"></label>
                    <div class="layui-input-block"><input class="layui-input" type="text" name="authId" th:value="${authId}"></div>
                </div>
                <div class="layui-inline layui-col-md3 p-r-xxs">
                    <label class="layui-form-label" th:text="授权值"></label>
                    <div class="layui-input-block"><input class="layui-input" type="text" name="authValue" th:value="${authValue}"></div>
                </div>
                <div class="layui-inline layui-col-md3 p-r-xxs">
                    <label class="layui-form-label" th:text="授权用户"></label>
                    <div class="layui-input-block"><input class="layui-input" type="text" name="authDesc" th:value="${authDesc}"></div>
                </div>
                <button class="layui-btn layui-btn-sm layui-btn-primary pull-right m-l-xs" title="重置数据" type="reset"><i class="layui-icon layui-icon-return"></i>重置</button>
                <button class="layui-btn layui-btn-sm layui-btn-normal pull-right btnPagerForm" title="重新检索"><i class="layui-icon layui-icon-search"></i>重新检索</button>
            </div>
        </div>
    </form>
    <div class="layui-row ljLayTableBox m-b-xl">
        <table class="layui-hide" id="indexTable" lay-filter="indexTable"></table>
    </div>
</div>
<!-- 头工具栏模板 -->
<script type="text/html" id="toolbarTpl">
    <div class="layui-btn-container">
        <button th:if="${@lj.limit('SysAuthAdd')>0}" class="layui-btn layui-btn-sm layui-btn-normal" title="添加系统" refTable="#indexTable" ljUrl="/sys/auth/add" target="ljOpenSubmit" ljWidth="800px">
            <i class="layui-icon layui-icon-add-circle"></i>添加授权
        </button>
        <button th:if="${@lj.limit('SysAuthImport')>0}" class="layui-btn layui-btn-sm layui-btn-warm" title="批量导入" refTable="#indexTable" ljUrl="/sys/auth/import" target="ljOpenCon" ljWidth="600px" ljHeight="450px">
            <i class="layui-icon layui-icon-upload-circle"></i>批量导入
        </button>
    </div>
</script>
<!-- 默认统一操作模板 -->
<div th:replace="common/operation :: pa_operation_default('SysAuth','授权一览','/sys/auth','{{d.id}}')"></div>
<!-- DataStatus枚举模板 -->
<div th:replace="common/enum :: pa_enum_DataStatus"></div>

<div th:replace="common/incBottom :: incBottom"></div>
<div th:replace="common/incPage :: incPage"></div>
<!-- 初始化表格数据 -->
<script th:inline="javascript">
    /*<![CDATA[*/
    let initSort = {
        field: [[${orderField}]] || 'id',
        type: [[${orderDirection}]] || 'desc'
    };
    let indexData = [];
    /*[# th:each="item,itemStat:${records}"]*/
    indexData.push({
        id: [[${item.id}]],
        authType: [[${item.authType}]],
        authId: [[${item.authId}]],
        authValue: [[${item.authValue}]],
        authDesc: [[${item.authDesc}]],
        authTime: [[${@lj.date(item.authTime)}]],
        authAvailable: [[${item.authAvailable}]],
        dataStatus: [[${item.dataStatus}]],
        createTime: [[${@lj.date(item.createTime)}]]
    });
    /*[/]*/
    /*]]>*/
</script>
<script th:inline="none">
    layui.use(["jquery", "table", "okLayer", "okPapper", "okUtils"], function () {
        let table = layui.table;
        let okPapper = layui.okPapper;
        let $ = layui.jquery;
        let okUtils = layui.okUtils;
        let config = okUtils.local("okConfig") || okConfig || {};
        okLoading.close($);
        table.render({
            elem: '#indexTable',
            data: indexData,
            height: 'full-118',
            page: false,
            limit: indexData.length,
            initSort: initSort,
            toolbar: false,
            toolbar: "#toolbarTpl",
            even: true,
            size: config.tableSize,
            cols: [[
                {field: "id", title: "编号", fixed: "left", width: 80, sort: true},
                {field: "authType", title: "授权方式", fixed: "left", width: 80},
                {field: "authId", title: "授权ID", fixed: "left", width: 100},
                {field: "authValue", title: "授权值", minWidth: 250,},
                {field: "authDesc", title: "授权用户", minWidth: 250},
                {field: "authTime", title: "授权时间", width: 150},
                {field: "authAvailable", title: "授权有效期(D)", width: 120},
                {field: "dataStatus", title: "数据状态", width: 90, align: 'center', templet: "#DataStatusTpl"},
                {field: "createTime", title: "添加时间", width: 150},
                {title: "操作", width: 220, align: "center", fixed: "right", templet: "#operationTpl"}
            ]],
            done: function (res, curr, count) {
            }
        });
        table.on('sort(indexTable)', function (obj) {
            $("input[name='orderField']").val(obj.field);
            $("input[name='orderDirection']").val(obj.type);
            $("#pagerForm").submit();
        });
        okPapper.init();
    })
</script>
</body>
</html>